<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" lang="zh" xmlns:th="http://www.thymeleaf.org" style="height: 100%">
<body class="body_hei edit">
<script th:src="@{/work/js/md5.js}"></script>
<style>
    .layui-form-item{border: none !important;background: none !important;}
</style>
<div th:replace="include/head.html::html"></div>
<form class="layui-form" action="">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">修改密码</div>
                    <div class="layui-card-body" pad15="">

                        <div class="layui-form" lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">当前密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" name="oldPwd" lay-verify="required" lay-vertype="tips" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">新密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" name="newPwd" lay-verify="pass" lay-vertype="tips" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">6到16个字符</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">确认新密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" name="newPwd2" lay-verify="repass" lay-vertype="tips" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <input type="hidden" name="oid" th:field="${bean.oid}"/>
                            <input type="hidden" name="account" th:field="${bean.account}"/>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="updatePwd_submit">确认修改</button>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

<script>
    layui.use(['form','jquery'], function(){
        var $ = layui.$
            , form = layui.form;
        //监听提交
        form.on('submit(updatePwd_submit)', function(data){
            $.post("sysuser/updatePwd",data.field,function (res) {
                if(res.code === 0){
                    layer.msg(res.msg);
                    $("input[name=newPwd]").val("");
                    $("input[name=newPwd2]").val("");
                    $("input[name=oldPwd]").val("");
                }else {
                    layer.msg(res.msg);
                }
            });
            return false;
        });

    });
</script>
</body>
</html>